import json, requests, time
url = 'http://192.168.1.39:30002/keywords/_bulk'

with open('seo.json', 'r') as f:
    data_all = f.readlines()
    count = 0
    for data in data_all:
        data = data.encode('utf-8')
        response = requests.post(url, data, headers={
            "Host": "192.168.1.39:30002",
            "Content-Length": "27961",
            "Content-Type": "application/json",
        })
        count+=1
        if response.status_code == 200 or response.status_code == 201:
            print(count, response.status_code, '成功')
            time.sleep(5)
        else:
            print(count, response.status_code, '失败')
            time.sleep(5)